﻿
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using WorkflowCore.Interface;
using WorkflowCore.Services.DefinitionStorage;

namespace Acme.BookStore.Workflow
{
    public class LeaveslipService : Volo.Abp.Application.Services.ApplicationService
    {
        

        public void getste() {

           IServiceProvider serviceProvider = ConfigureServices();
            var host = serviceProvider.GetService<IWorkflowHost>();
            host.RegisterWorkflow<RbacWorkflowCoreService>();
            host.Start();

            host.StartWorkflow("RbacWorkflowCoreService", 1, null);
            
            host.Stop();

        }

        private static IServiceProvider ConfigureServices()
        {
            //setup dependency injection
            IServiceCollection services = new ServiceCollection();
            services.AddLogging();
            services.AddWorkflow();
            services.AddWorkflowDSL();

            var serviceProvider = services.BuildServiceProvider();

            return serviceProvider;
        }

    }
}
